/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gmovil_jpa.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author castlerock
 */
@Entity
@Table(name = "detalle_factura_articulo")
@NamedQueries({
    @NamedQuery(name = "DetalleFacturaArticulo.findAll", query = "SELECT d FROM DetalleFacturaArticulo d"),
    @NamedQuery(name = "DetalleFacturaArticulo.findByIdDetalleFacturaArticulo", query = "SELECT d FROM DetalleFacturaArticulo d WHERE d.idDetalleFacturaArticulo = :idDetalleFacturaArticulo"),
    @NamedQuery(name = "DetalleFacturaArticulo.findByPrecio", query = "SELECT d FROM DetalleFacturaArticulo d WHERE d.precio = :precio"),
    @NamedQuery(name = "DetalleFacturaArticulo.findByIva", query = "SELECT d FROM DetalleFacturaArticulo d WHERE d.iva = :iva"),
    @NamedQuery(name = "DetalleFacturaArticulo.findByDescuento", query = "SELECT d FROM DetalleFacturaArticulo d WHERE d.descuento = :descuento"),
    @NamedQuery(name = "DetalleFacturaArticulo.findBySerialAnterior", query = "SELECT d FROM DetalleFacturaArticulo d WHERE d.serialAnterior = :serialAnterior"),
    @NamedQuery(name = "DetalleFacturaArticulo.findByImeiAnterior", query = "SELECT d FROM DetalleFacturaArticulo d WHERE d.imeiAnterior = :imeiAnterior"),
    @NamedQuery(name = "DetalleFacturaArticulo.findByIccAnterior", query = "SELECT d FROM DetalleFacturaArticulo d WHERE d.iccAnterior = :iccAnterior"),
    @NamedQuery(name = "DetalleFacturaArticulo.findByMarcaAnterior", query = "SELECT d FROM DetalleFacturaArticulo d WHERE d.marcaAnterior = :marcaAnterior"),
    @NamedQuery(name = "DetalleFacturaArticulo.findByModeloAnterior", query = "SELECT d FROM DetalleFacturaArticulo d WHERE d.modeloAnterior = :modeloAnterior")})
public class DetalleFacturaArticulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_detalle_factura_articulo")
    private Integer idDetalleFacturaArticulo;
    @Basic(optional = false)
    @Column(name = "precio")
    private double precio;
    @Basic(optional = false)
    @Column(name = "iva")
    private double iva;
    @Basic(optional = false)
    @Column(name = "descuento")
    private double descuento;
    @Column(name = "serial_anterior")
    private String serialAnterior;
    @Column(name = "imei_anterior")
    private Integer imeiAnterior;
    @Column(name = "icc_anterior")
    private String iccAnterior;
    @Column(name = "marca_anterior")
    private String marcaAnterior;
    @Column(name = "modelo_anterior")
    private String modeloAnterior;
    @JoinColumn(name = "fid_articulo", referencedColumnName = "id_articulo")
    @ManyToOne(optional = false)
    private Articulo articulo;
    @JoinColumn(name = "fid_tipo_operacion_comercial", referencedColumnName = "id_tipo_operacion_comercial")
    @ManyToOne(optional = false)
    private TipoOperacionComercial tipoOperacionComercial;
    @JoinColumn(name = "fid_factura", referencedColumnName = "id_factura")
    @ManyToOne(optional = false)
    private Factura factura;

    public DetalleFacturaArticulo() {
    }

    public DetalleFacturaArticulo(Integer idDetalleFacturaArticulo) {
        this.idDetalleFacturaArticulo = idDetalleFacturaArticulo;
    }

    public DetalleFacturaArticulo(Integer idDetalleFacturaArticulo, double precio, double iva, double descuento) {
        this.idDetalleFacturaArticulo = idDetalleFacturaArticulo;
        this.precio = precio;
        this.iva = iva;
        this.descuento = descuento;
    }

    public Integer getIdDetalleFacturaArticulo() {
        return idDetalleFacturaArticulo;
    }

    public void setIdDetalleFacturaArticulo(Integer idDetalleFacturaArticulo) {
        this.idDetalleFacturaArticulo = idDetalleFacturaArticulo;
    }

    public double getPrecio() {
        return precio;
    }

    public void setPrecio(double precio) {
        this.precio = precio;
    }

    public double getIva() {
        return iva;
    }

    public void setIva(double iva) {
        this.iva = iva;
    }

    public double getDescuento() {
        return descuento;
    }

    public void setDescuento(double descuento) {
        this.descuento = descuento;
    }

    public String getSerialAnterior() {
        return serialAnterior;
    }

    public void setSerialAnterior(String serialAnterior) {
        this.serialAnterior = serialAnterior;
    }

    public Integer getImeiAnterior() {
        return imeiAnterior;
    }

    public void setImeiAnterior(Integer imeiAnterior) {
        this.imeiAnterior = imeiAnterior;
    }

    public String getIccAnterior() {
        return iccAnterior;
    }

    public void setIccAnterior(String iccAnterior) {
        this.iccAnterior = iccAnterior;
    }

    public String getMarcaAnterior() {
        return marcaAnterior;
    }

    public void setMarcaAnterior(String marcaAnterior) {
        this.marcaAnterior = marcaAnterior;
    }

    public String getModeloAnterior() {
        return modeloAnterior;
    }

    public void setModeloAnterior(String modeloAnterior) {
        this.modeloAnterior = modeloAnterior;
    }

    public Articulo getArticulo() {
        return articulo;
    }

    public void setArticulo(Articulo articulo) {
        this.articulo = articulo;
    }

    public TipoOperacionComercial getTipoOperacionComercial() {
        return tipoOperacionComercial;
    }

    public void setTipoOperacionComercial(TipoOperacionComercial tipoOperacionComercial) {
        this.tipoOperacionComercial = tipoOperacionComercial;
    }

    public Factura getFactura() {
        return factura;
    }

    public void setFactura(Factura factura) {
        this.factura = factura;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDetalleFacturaArticulo != null ? idDetalleFacturaArticulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleFacturaArticulo)) {
            return false;
        }
        DetalleFacturaArticulo other = (DetalleFacturaArticulo) object;
        if ((this.idDetalleFacturaArticulo == null && other.idDetalleFacturaArticulo != null) || (this.idDetalleFacturaArticulo != null && !this.idDetalleFacturaArticulo.equals(other.idDetalleFacturaArticulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gmovil_jpa.entidades.DetalleFacturaArticulo[idDetalleFacturaArticulo=" + idDetalleFacturaArticulo + "]";
    }

}
